<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>清算机构设置</title>
	<script type="text/javascript" language="JavaScript" src="../script/common.js"></script>
	<script type="text/javascript" language="JavaScript" src="../script/tree.js"></script>
	<script type="text/javascript" language="JavaScript">
	var tree;
	var qt = {};	
	var org = Common.cOrg();
	var openIcon = "../images/tree/root.png";
	var icon = "../images/tree/root.png";	
	
	var orgLevelMap = {}
	
	function load(){
		Eui.showNavigation();//导航
		writeTree()
	}
	

	/**树**/
	function writeTree(){
		if (tree)
			webTreeHandler.init();
		tree = new LoadTree(org.name, org.id,"javascript:showProperty()",null,"../images/tree/root.png","../images/tree/root.png");
		tree.obj = org;
		$("treeDiv").innerHTML = tree;
		treeform.reset()
	}
	function _startLoadXmlTree(sSrc, jsNode,newNode) {
		DWR.call("partyService.findOrgByParent",sSrc,function(result){
			_xmlFileLoaded(result,jsNode);
		});
	}
	
	function _createNode(obj){
		if(obj.id)
			node = createTreeNode(obj.orgLevel=="700",obj.name,obj.id,"javascript:showProperty()");
		else
			node = createTreeNode(true,"新单位",null,"javascript:showProperty()");
		node.obj = obj;
		return node;
	}
	
	function showProperty(){
		var node = tree.getSelected();
		treeform.treeNodeId = node.id;
		onEdit(node.obj.id,treeform);
	}
	
	/**组织机构保存**/			
	function onSetting(){
		var organ = Common.getValues(treeform);
		if (organ.id){
			DWR.call("partyService.saveOrganization",organ,function(r){	
				showInformation("清算机构设置成功！")
			},{disCtrl:findBtns(treeform)})
		}
	}
	/**组织机构明细**/
	//组织机构修改
	function onEdit(id,form){
		if (id){
			DWR.call("partyService.getOrganization", id, function(result) {
				var org = result.organization;
				org.parentname = result.parentName;
				org.orgLevelName = Common.getText("org_level",org.orgLevel)
				Common.setValues(form,operator);
			});
		}else{
			form.reset();
		}
	}
	function onCancel(){
		var node = tree.getSelected()
		if (!node)
			return;
		else if (!node.obj.id){
			node.remove();
		}
		showProperty();	
	}
	
</script>
</head>

<body onload="load()" class="noScroll">
<table cellspacing="0" cellpadding="0" border="0" width="100%" height="100%">
<tr><td>
	<table cellspacing="0" cellpadding="0" border="0" width="100%">
		<tr>
			<td class="nav">
				<div id="nav">&nbsp;</div>
			</td>
		</tr>
	</table>
</td></tr>
<tr><td height="100%" valign="top" id="treemode">
	<table cellspacing="0" cellpadding="0" border="0" width="100%" height="100%">
		<tr>
			<td class="treeBar"></td>
			<td class="treeBar"></td>
		</tr>
		<tr class="treeBody">
			<td valign=top width=30%>					
				<div id=treeDiv class="scrollDiv treeDiv"></div>
			</td>
			<td valign="top" align="center">
				<div id="treeDet" class="scrollDiv pad5">
					<form id="treeform" name="treeform">
						<input type=hidden id=id name=id>
						<div class="form">
							<div class="formTitle">清算单位信息</div>
							<table cellSpacing="0" cellPadding="4" width="100%" border="0" class="col2">
								<tr>
									<td><label>上级机构</label> <input type=text name=parentname id=parentname disabled></td>
									<td><label>机构级别</label> <input type=text name=orgLevelName id=orgLevelName disabled></td>
								</tr>
								<tr>
									<td><label>机构名称</label> <input type=text name=name id=name maxlength=50 disabled></td>
									<td><label>机构编码</label> <input type=text name="uniqueId" id="uniqueId" disabled></td>
								</tr>	
								<tr>
									<td><label>注册时间</label> <input type=text name="registerTime" id="registerTime" disabled></td>
									<td><label>有效时间</label> <input type=text name='invalidTime' id='invalidTime' disabled></td>
								</tr>	
								<tr>
									<td><label>联系电话</label> <input type=text name='phone' id='phone' maxlength=20 disabled></td>
									<td><label>联系地址</label> <input type=text name='address' id='address' maxlength=200 disabled></td>
								</tr>	
									
								<tr>
									<td colspan="2" align="center"><label>是否为清算机构：&nbsp;</label> 
										是&nbsp;<input type="radio" name="isClear" value="true">&nbsp;&nbsp;&nbsp;
									 	否&nbsp;<input type="radio" name="isClear" value="false">
									 </td>
								</tr>	
							</table>
						</div>
						<button onclick='onSetting();'>保 存</button>
						<button onclick='onCancel()'>取 消</button>
					</form>
				</div>
			</td>
		</tr>
	</table>
</td></tr></table>
</body>
</html>
